UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kSdiLnTIbERxMd/T2laVCVHOeoyfLj8uavPt+R43l88=' 
WHERE 
  key_id = 'cd0fdc16bd32c166021ee26467e59716ec766525c7f60739c4c4c2822b6a190f' 
  AND (
    token = 'kSdiLnTIbERxMd/T2laVCVHOeoyfLj8uavPt+R43l88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034