UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HSYVT50+NxCp2HfMRSwjhyUsRlSZHxIuu+7/ccdGh54=' 
WHERE 
  key_id = '749abe6c2501e8c0f6993705630ea89b960be0e9dfbe46af0c61b7de14397f9f' 
  AND (
    token = 'HSYVT50+NxCp2HfMRSwjhyUsRlSZHxIuu+7/ccdGh54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016