UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4VyQshsA22k/niMAXuTGX3+dD7F7Vz/rq+K60J9l+1A=' 
WHERE 
  key_id = 'f007e2ec9ba3a0a1057554602e1ba3d79ce28dbcc08bd03547ac28af048aa695' 
  AND (
    token = '4VyQshsA22k/niMAXuTGX3+dD7F7Vz/rq+K60J9l+1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017