UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ze/tYCU0kHxS8NowqE8A2p2+31ueLFz4+tbJO+wX7O8=' 
WHERE 
  key_id = '56677ae8379c625f905144c265530803776caf886c36a9c445a547622d0f3d26' 
  AND (
    token = 'Ze/tYCU0kHxS8NowqE8A2p2+31ueLFz4+tbJO+wX7O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020