UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SF0boLR0uxA17dkLQYCfW2gcGIrujRnsWkxlPYpaH4M=' 
WHERE 
  key_id = '8f29a1c180f0ea477e05046b4b3133f505b6f8e5c83b55cb8ad0cbe21fa4135f' 
  AND (
    token = 'SF0boLR0uxA17dkLQYCfW2gcGIrujRnsWkxlPYpaH4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019