UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdl+wDQDeZ5LCpk7o163t12c/RjvyxYjk8ZagUJ4vuw=' 
WHERE 
  key_id = 'ad9464a61828ef01c5811b4f82dcf72c334cbf4fb4d9980672304b870eb56961' 
  AND (
    token = 'cdl+wDQDeZ5LCpk7o163t12c/RjvyxYjk8ZagUJ4vuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032