UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OSns0a18ivB8DS4JNin/u3eQh7WoxNWzVRSRVocw4es=' 
WHERE 
  key_id = '5f2726b19db7f33ccc5e39079267b48a4fd7325a44bdf5464e024c078c510b6a' 
  AND (
    token = 'OSns0a18ivB8DS4JNin/u3eQh7WoxNWzVRSRVocw4es=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022