UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CTr6htfeO14jG88xn8Cw38e4pB2V2mFdPQuMuZ1dPDg=' 
WHERE 
  key_id = 'a5eb68e3181061be9d2aa59b79ea707d78e774360f3d009dd329c13157fe5e69' 
  AND (
    token = 'CTr6htfeO14jG88xn8Cw38e4pB2V2mFdPQuMuZ1dPDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037