UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pck3wE4eXeLnk2UlkDfLgmEbyTnp9KXMMqLednraUY8=' 
WHERE 
  key_id = '96c829c1f406cbaa690df142532b469804e1f7facc6924bb2cda33121be38852' 
  AND (
    token = 'pck3wE4eXeLnk2UlkDfLgmEbyTnp9KXMMqLednraUY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025