UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9q6fkE4aDM6r9Pwau/uj21Q/z/bCNJ0oEi2UkaLfZSY=' 
WHERE 
  key_id = '5a527cf5ca6d1174517a772ef763fd395a9870473de2356bed0adc338babd808' 
  AND (
    token = '9q6fkE4aDM6r9Pwau/uj21Q/z/bCNJ0oEi2UkaLfZSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030