UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6+J1NpbiQbLZYRxStrcnE04PJN7XEo7rH90L5eg0lSk=' 
WHERE 
  key_id = '9f3711845c8386173ee22c66be24b54ce08ce4c17c70e5410eb512f18f5a6912' 
  AND (
    token = '6+J1NpbiQbLZYRxStrcnE04PJN7XEo7rH90L5eg0lSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027