UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2PYwrGidgLVlAxpWmyhVuPoZTlm0BWQ3iWpBSMyufGc=' 
WHERE 
  key_id = '313039161b4965cab116c0632dc2eea41bab1393590cfe77b04e9fb2f9ee7531' 
  AND (
    token = '2PYwrGidgLVlAxpWmyhVuPoZTlm0BWQ3iWpBSMyufGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030