UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3SaslQY391etMupklYqFw/7J6mS+Krdue5qI/j67EA0=' 
WHERE 
  key_id = 'd1c677cf1d9b45b8125e1612edcf634a04cec797afad6555f1a51a8040674d72' 
  AND (
    token = '3SaslQY391etMupklYqFw/7J6mS+Krdue5qI/j67EA0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032