UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kLP1t+bhtJcQouUEj2tp5Us4Fvbd7Rgqlp0guJ5fwjA=' 
WHERE 
  key_id = '7b055c9c1935bc9b6144d3b0d6c4783126d570266e1a4e8ce121e1f48921fa84' 
  AND (
    token = 'kLP1t+bhtJcQouUEj2tp5Us4Fvbd7Rgqlp0guJ5fwjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040