UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TW2Hdu0C5Xm5MaexKMEwyBgXMU9GBojUQ5QJZoSV5uw=' 
WHERE 
  key_id = '6a98d667131958b56f09c9f70f3f11323b7268764211bcd17e20d49c2d76251c' 
  AND (
    token = 'TW2Hdu0C5Xm5MaexKMEwyBgXMU9GBojUQ5QJZoSV5uw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029