UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gMsYnp3wp5KUqg3U/+/Yq6mAOcqP+RpRIp6H8mcdCUc=' 
WHERE 
  key_id = 'bdad45adf03b1abdb893382921a301dca70b1c6bcdb618397f704f77427aa4ba' 
  AND (
    token = 'gMsYnp3wp5KUqg3U/+/Yq6mAOcqP+RpRIp6H8mcdCUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021