UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yhvjcVoYMPKC8VoxK3MNDLyTAmeTSwyUA+O6AzbZv2s=' 
WHERE 
  key_id = '8a2bb7ff484d6771b5657ceef30ae77a1828d786a2832b56294c252a08efb762' 
  AND (
    token = 'yhvjcVoYMPKC8VoxK3MNDLyTAmeTSwyUA+O6AzbZv2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046