UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TFluJxCOk3XOOCa5NWbKkXXFnTA9cVFK8+KCcRbZYS8=' 
WHERE 
  key_id = 'f28f7ea407d86278742033c9e42fca0977e2be2ff578041a2895d960657c184a' 
  AND (
    token = 'TFluJxCOk3XOOCa5NWbKkXXFnTA9cVFK8+KCcRbZYS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037