UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OprUWqM7HQgnNq5SSFm6OS/45ivVNg0Ral+hQ4i+ljA=' 
WHERE 
  key_id = '68c20160a9cd88cc323823401809a376bd93ec490d76df2e1fe4b312e1873241' 
  AND (
    token = 'OprUWqM7HQgnNq5SSFm6OS/45ivVNg0Ral+hQ4i+ljA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031