UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hciFYb+z29cNpUzs9SMd10hYC6FT/pzdMbgrMTieFj8=' 
WHERE 
  key_id = 'c0b3a47922c81a78aaba4e1af355f69ae77723d2b5c919f126e162ba5077aa2f' 
  AND (
    token = 'hciFYb+z29cNpUzs9SMd10hYC6FT/pzdMbgrMTieFj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031