UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S3LVqwRHLdnFFhE+RIBPxYy14bgYL0kKVUkfYuRQmkE=' 
WHERE 
  key_id = '122c3bff074ef7b1ac70a5453e4a9755d27214beb4a001409f8529944ec7c6cf' 
  AND (
    token = 'S3LVqwRHLdnFFhE+RIBPxYy14bgYL0kKVUkfYuRQmkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035