UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JdOo3Sk85zAVDADu9GctYLl4AtJPbiggPNOlfU+jitY=' 
WHERE 
  key_id = 'b6bae503511bb5f20e1af3d8f0789d1212d9c274c772c93a7273da77822167bd' 
  AND (
    token = 'JdOo3Sk85zAVDADu9GctYLl4AtJPbiggPNOlfU+jitY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061