UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5zBHseFYWENxO0fLZQHL/Ay/i83yNkPBZPB2exuxg0=' 
WHERE 
  key_id = '99309b9c5cce76d5725af528a28518ad32b10607e35f8380bca677ceb26355a3' 
  AND (
    token = 'G5zBHseFYWENxO0fLZQHL/Ay/i83yNkPBZPB2exuxg0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035