UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5lGvdtzm9Htwd6FE6PpI4lENaOw8ZHaU74bs9rmROqE=' 
WHERE 
  key_id = '8ddb38bb9998134b153919a6c531e6921dbab0f950a93a1e0f2c3ea1a1a04f47' 
  AND (
    token = '5lGvdtzm9Htwd6FE6PpI4lENaOw8ZHaU74bs9rmROqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027