UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z+Wk1RmutiVcDKstBYEYG9jvutX7lIOns1nayeYfpqc=' 
WHERE 
  key_id = '8be02b150398f403b717b0004556876892b4b496f3d1c4dea359bd5673b8397a' 
  AND (
    token = 'Z+Wk1RmutiVcDKstBYEYG9jvutX7lIOns1nayeYfpqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018