UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YGnHItFIAm9bQ1SPT2wemNiGFiw6ZWdVLhtmoaWvS5I=' 
WHERE 
  key_id = '5ab967d154e942eaeeaaa44294ed9d752bdf31b1f7a04d17d138f0df49d896a6' 
  AND (
    token = 'YGnHItFIAm9bQ1SPT2wemNiGFiw6ZWdVLhtmoaWvS5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049