UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XpBN9xr7trvXIpvPizXdqquaAYAwvCRLNc6MZh3/4ek=' 
WHERE 
  key_id = '0fa5427ec3aa5ae436cbf43228cb9184db6280abc78577612d563d1a25b33adb' 
  AND (
    token = 'XpBN9xr7trvXIpvPizXdqquaAYAwvCRLNc6MZh3/4ek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038