UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FigrLwe0OOC1z7ViFUZhS1b7SGKutvqrkYp3fVS6WgY=' 
WHERE 
  key_id = '3f5914743b3b683b71f656d65ca43faea89e3afce924ccab555e550241d7ba18' 
  AND (
    token = 'FigrLwe0OOC1z7ViFUZhS1b7SGKutvqrkYp3fVS6WgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049