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

Query time 0.00032